Repository navigation
feat(ra): pluggable server-cert issuance via certificate-order lifecycle - #45
Conversation
Wire an RFC 8555 ACME provider (Let's Encrypt-shaped) alongside the local self-signed CA behind a single port.ServerCertificateIssuer, so a deployment can swap in a public/cloud CA without touching the service layer. Issuance runs through a certificate-order lifecycle: - CreateOrder (at registration/renewal submission) returns the provider's domain-control challenges, relayed verbatim to the domain owner. ANS never writes DNS or serves challenge files on their behalf. - FinalizeOrder (at verify-acme, gated on a verified challenge) returns the cert, or ErrOrderPending for asynchronous providers such as ACME CAs; re-POSTing verify-acme re-drives the order (202 / PENDING_CERTS). Identity certificates remain privately issued behind port.IdentityCertificateAuthority (self-CA default, swappable for AWS Private CA / GCP CAS), signed only after the server order completes. Both CA ports gain an idempotent RevokeCertificate. Close several holes so the flows behave correctly regardless of the underlying adapter: - Always gate FinalizeOrder on a verified DNS-01 or HTTP-01 artifact; gate/order rejections return 422, pending-conflict 409. - SSRF-harden the HTTP-01 verifier: guarded dialer rejecting non-public dial targets (loopback, link-local incl. the cloud metadata endpoint, RFC 1918, ULA, RFC 6598 CGNAT 100.64/10, 6to4, NAT64), refuse redirects, bounded body read. - Distinguish "no server cert on file" from a transient store failure, so a recoverable fault can never activate an agent and sign a wrong, immutable transparency-log leaf. - Persist order/challenge state and certificate serial/ref in SQLite (migrations 006/007); guarded set-based expiry of lapsed pending validations; in-process agent auto-expiry sweeper. spec/api-spec-v2.yaml and the docsui copy stay byte-identical. internal/domain remains at 100% statement coverage; overall >=90%; race-clean. Signed-off-by: Connor Snitker <csnitker@godaddy.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors server TLS certificate issuance behind a pluggable port.ServerCertificateIssuer with an explicit certificate-order lifecycle (create → verify/finalize), enabling external RFC 8555 ACME providers (e.g., Let’s Encrypt) alongside the existing self-signed CA. It also adds persisted order/challenge state and certificate identifiers, plus an HTTP-01 verifier with SSRF protections, wiring the async “pending issuance” path end-to-end.
Changes:
- Introduce certificate-order lifecycle + persistence (orders/challenges + issued cert serial/ref) and derived statuses/phases (e.g.,
PENDING_CERTS,CERTIFICATE_ISSUANCE). - Add ACME server-certificate issuer adapter (with in-process ACME fake for tests) and demo wiring (
--with-acme). - Add HTTP-01 challenge verification adapter with SSRF guard; update handlers/mappers/specs/tests accordingly.
Reviewed changes
Copilot reviewed 65 out of 65 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/api-spec-v2.yaml | Updates pending status/next-step enums to include PENDING_CERTS and CANCEL. |
| internal/adapter/docsui/openapi/ra.yaml | Mirrors the OpenAPI enum updates for docs UI. |
| internal/port/certauthority.go | Replaces server CA port with order-based ServerCertificateIssuer; adds order/issuer errors and request types. |
| internal/port/challenge.go | Adds HTTPChallengeVerifier port for HTTP-01 artifact verification. |
| internal/port/store.go | Adds ExpireLapsedPendingValidation to support registration auto-expiry sweeps. |
| internal/domain/order.go | Adds first-class CertificateOrder / Challenge models and order state machine. |
| internal/domain/order_test.go | Tests order/challenge behaviors and transitions. |
| internal/domain/agent.go | Replaces legacy ACME challenge with persisted order and updated cancel eligibility rules. |
| internal/domain/agent_test.go | Updates/extends cancel/revoke behavior tests for the new order lifecycle. |
| internal/domain/renewal.go | Refactors renewal validation to carry order ref + challenge set; fixes completion semantics. |
| internal/domain/renewal_test.go | Updates renewal tests for challenge-set validation and completion rules. |
| internal/domain/dnsrecords.go | Factors TLSA record generation into TLSARecordForCert for reuse. |
| internal/domain/certificate.go | Adds SerialNumber/CertificateRef to stored certificate model. |
| internal/domain/ansname.go | Rejects IP-literal hosts to reduce SSRF risk for HTTP-01 verification. |
| internal/domain/ansname_test.go | Adds tests for IP-literal rejection. |
| internal/adapter/challenge/http.go | Implements SSRF-hardened HTTP-01 verifier. |
| internal/adapter/challenge/http_test.go | Unit tests for HTTP-01 verifier behavior + SSRF guard. |
| internal/adapter/cert/acme.go | Implements ACME-based ServerCertificateIssuer (RFC 8555) with async finalize support. |
| internal/adapter/cert/acmetest/acmetest.go | In-process fake ACME server for hermetic adapter tests. |
| internal/adapter/cert/acmetest/acmetest_test.go | Tests the ACME fake’s own protocol-violation reporting. |
| internal/adapter/cert/le_live_smoke_test.go | Opt-in live smoke test against Let’s Encrypt staging. |
| internal/adapter/cert/serverselfca.go | Updates self-signed server CA to the order lifecycle (CreateOrder/FinalizeOrder). |
| internal/adapter/cert/selfca.go | Updates identity CA revocation signature to use RevokeCertificateRequest. |
| internal/adapter/cert/cert_test.go | Updates cert tests for the new issuer/revocation contracts and order lifecycle. |
| internal/adapter/store/sqlite/migrations/006_certificate_orders.sql | Adds order persistence columns for registrations and renewals. |
| internal/adapter/store/sqlite/migrations/007_certificate_identifiers.sql | Adds serial/provider-handle persistence for issued certs. |
| internal/adapter/store/sqlite/agent.go | Persists/loads certificate orders; adds guarded auto-expiry UPDATE. |
| internal/adapter/store/sqlite/renewal.go | Persists/loads renewal order refs + challenge sets with legacy fallback. |
| internal/adapter/store/sqlite/certificate.go | Persists/loads serial number and provider handle for issued certs. |
| internal/adapter/store/sqlite/order_persistence_test.go | Round-trip tests for order/challenge persistence + legacy synthesis. |
| internal/ra/service/registration.go | Registers using server issuer order lifecycle; clamps challenge windows; wires HTTP-01 verifier. |
| internal/ra/service/helpers.go | Adds distinct “cert missing” vs “store error” handling; adds PEM serial parsing helper. |
| internal/ra/service/helpers_internal_test.go | Tests serialFromCertPEM error cases. |
| internal/ra/service/v1event.go | Treats server-cert store errors as fatal when building immutable V1 attestation. |
| internal/ra/service/agent_expiry.go | Adds registration auto-expiry worker/sweep function. |
| internal/ra/service/renewal_expiry_test.go | Updates renewal expiry tests for challenge set model. |
| internal/ra/service/registration_test.go | Updates service tests for issuer wiring and DNS verifier setup. |
| internal/ra/service/identity_flow_test.go | Adds tests for identity CSR rotation, revocation semantics, cancel/expiry behaviors. |
| internal/ra/handler/registration.go | Updates V2 pending response challenges to relay provider fields (DNS-01 + HTTP-01). |
| internal/ra/handler/dto.go | Derives phase/steps from (lifecycle status × order state); adds PENDING_CERTS pending block. |
| internal/ra/handler/renewalmap.go | Surfaces renewal challenges + TLSA record; fixes async “WAIT” guidance to point to verify-acme. |
| internal/ra/handler/v1registration.go | Updates V1 pending view to use persisted order + adds WAIT/CANCEL guidance for issuing/failed orders. |
| internal/ra/handler/v1renewal.go | Aligns async renewal next-step endpoint and includes TLSA record in V1 responses. |
| internal/ra/handler/lifecycle.go | Uses order-derived phase/steps and order expiry in verify-acme/dns responses. |
| internal/ra/handler/v1lifecycle.go | Mirrors phase/step derivation changes for V1 lifecycle endpoints. |
| internal/ra/handler/lifecycle_test.go | Updates handler fixture to use the new issuer wiring. |
| internal/ra/handler/order_dto_test.go | Adds tests pinning order-derived DTO shapes/statuses/phases. |
| internal/ra/handler/dto_more_test.go | Updates tests for phase/step derivation changes. |
| internal/ra/handler/dto_helpers_test.go | Updates mapping tests for new renewal-status/result shapes. |
| internal/ra/middleware/ownership_test.go | Updates fake AgentStore to satisfy the new expiry method. |
| internal/config/config.go | Adds ca.server issuer type selection (self/acme) and validation rules (acme requires lookup DNS). |
| internal/config/config_test.go | Adds tests for ACME server issuer validation and new error branches. |
| cmd/ans-ra/main.go | Wires HTTP-01 verifier + builds server issuer based on config; starts agent-expiry checker worker. |
| scripts/demo/start.sh | Adds --with-acme demo mode and issuer-mode guard for --keep. |
| scripts/demo/register.sh | Shows relayed DNS challenge info in --register-only mode. |
| scripts/demo/renewal.sh | Updates wording to reflect issuer/order finalization at verify-acme. |
| scripts/demo/acme-verify.sh | New script to drive the ACME verify-acme loop until issuance completes. |
| config/ra-local.yaml | Documents optional server issuer config for self/acme modes. |
| Makefile | Excludes acmetest scaffolding from coverage instrumentation. |
| go.mod | Promotes golang.org/x/crypto to a direct dependency for ACME. |
| CLAUDE.md | Updates architecture notes for new issuer + HTTP-01 verifier ports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| base, ok := http.DefaultTransport.(*http.Transport) | ||
| if !ok { | ||
| // The stdlib default is always *http.Transport; fall back to a | ||
| // fresh one if some test rewired it. | ||
| base = &http.Transport{} | ||
| } | ||
| t := base.Clone() | ||
| t.DialContext = d.DialContext | ||
| return t |
There was a problem hiding this comment.
Fixed in 602b309 — guardedTransport() now sets Proxy = nil, so the transport always dials the resolved FQDN directly and the dial guard stays authoritative regardless of HTTP_PROXY/HTTPS_PROXY. Added TestSSRFGuard_DisablesProxy.
| func (c *ServerSelfCA) FinalizeOrder( | ||
| ctx context.Context, | ||
| csrPEM string, | ||
| fqdn string, | ||
| req port.FinalizeOrderRequest, | ||
| ) (*port.IssuedCert, error) { | ||
| csr, err := anscrypto.ValidateServerCSR(csrPEM, fqdn) | ||
| csr, err := anscrypto.ValidateServerCSR(req.CSRPEM, req.FQDN) | ||
| if err != nil { | ||
| return nil, err | ||
| } |
There was a problem hiding this comment.
Good call — ServerSelfCA.FinalizeOrder now requires a non-empty OrderRef (returns an error otherwise). The stateless self-CA still doesn't look anything up by it, but this keeps the contract uniform with the ACME issuer (which needs the ref to resume the order), so a dropped ref fails the same way in dev as against Let's Encrypt. Done in a924551.
| type ServerCertificateIssuer interface { | ||
| // CreateOrder opens an issuance order for the agent's FQDN and | ||
| // returns the provider's domain-control challenges. The CSR is NOT | ||
| // required yet (matching ACME, where the CSR is presented at | ||
| // finalize). The returned order is persisted on the registration |
There was a problem hiding this comment.
Correct — only IdentityCertificateAuthority has RevokeCertificate; ServerCertificateIssuer does not. Updated the PR description to scope the claim to the identity CA port and note server-cert revocation is intentionally out of scope for now (ACME RFC 8555 §7.6 for public CAs, a noop for BYOC).
Integrate the verified-identities feature (did:web + did:key, #41) and the golang.org/x/mod 0.37 bump (#44) from main. Conflict resolutions: - Makefile test-cover: union the coverpkg exclusions — cmd/*, scripts/* (main), and acmetest (ours). - go.mod: x/crypto becomes a direct dependency at v0.51.0 (we import x/crypto/acme); keep main's x/mod 0.37.0 and x/net 0.54.0. go.sum reconciled via `go mod tidy`. - internal/config/config.go: keep both validation blocks — our ACME + noop-DNS footgun guard and main's identity-resolver/TTL/rate-limit checks. - cmd/ans-ra/main.go: keep both adapter imports (challenge + didresolver). - SQLite migrations: main took 006_identities / 007_identity_seal_claim, so our certificate-order migrations are renumbered to 008_certificate_orders / 009_certificate_identifiers (and the in-code "migration 006/007" references updated to 008/009). - internal/ra/handler/identity_handler_test.go: main's test used the pre-refactor WithServerCertificateAuthority; updated to the reshaped WithServerCertificateIssuer. - internal/domain/errors_test.go: cover main's NewUnavailableError to keep internal/domain at 100%. make check (90.1%), make test-race, and make build all pass on the merged tree; spec and docsui OpenAPI copies remain byte-identical. Signed-off-by: Connor Snitker <csnitker@godaddy.com>
The guarded transport cloned http.DefaultTransport, which carries Proxy: ProxyFromEnvironment. With HTTP_PROXY/HTTPS_PROXY set in the RA's environment, the dialer connected to the proxy — whose own address the Control-hook guard sees as public and allows — and the proxy then fetched the registrant-controlled (potentially internal) target on the verifier's behalf, fully bypassing the non-public-IP dial guard. Set Proxy=nil so the transport always dials the resolved FQDN directly and the Control hook governs the real target. HTTP-01 domain-control validation must reach the domain itself, so proxying is never wanted. Reported by Copilot on PR review. Signed-off-by: Connor Snitker <csnitker@godaddy.com>
There was a problem hiding this comment.
Looks good. Tested demo with acme. Was able to get an agent active with a server certificate issued from LE.
I had some issues doing a cert renewal with a CSR I created.
The response from CSR submission looked fine:
{
"renewalType": "SERVER_CSR",
"status": "PENDING_VALIDATION",
"csrId": "8201337a-64f2-4e49-8906-5497c5aee24d",
"expiresAt": "2026-06-25T16:29:43+10:00",
"nextStep": {
"action": "VALIDATE_DOMAIN",
"endpoint": "/v2/ans/agents/8d1e69ee-ea7c-4be0-857b-38db9262198a/certificates/server/renewal/verify-acme",
"description": "Complete ACME challenges then POST to verify-acme endpoint"
},
"links": [
{
"rel": "status",
"href": "/v2/ans/agents/8d1e69ee-ea7c-4be0-857b-38db9262198a/certificates/server/renewal"
}
]
}
But when trying the verify-acme endpoint there was an issue which I couldn't diagnose - this might be a quirk of LE.
{
"type": "about:blank",
"title": "Validation Failed",
"status": 422,
"detail": "certificate provider reported a terminal order failure; submit a new renewal",
"code": "CERT_ORDER_FAILED"
}
Let's add some more logging for the error branches - will help implementers to diagnose issues.
… guard
Address PR review feedback.
ACME issuer (jhateley): add a WithLogger option (zerolog, component-
tagged, defaulting to Nop, mirroring IdentityService.WithLogger) and log
the order lifecycle so issuance against an external CA is debuggable from
the RA logs:
- INFO "acme order opened" {fqdn, orderRef, acmeStatus} on CreateOrder,
plus the relayed domain state per branch (pending vs authz-reuse).
- INFO "acme finalizing order" {fqdn, orderRef} and INFO "acme order
finalized" {fqdn, orderRef, serialNumber} on success.
- ERROR on upstream/provider failures (new-order, collect challenges,
get order, answer challenges, fetch cert, invalid/unexpected status)
with .Err and the order ref; DEBUG on the expected ErrOrderPending
re-drive path so it isn't logged as an error.
Wired through buildServerIssuer in cmd/ans-ra.
Self-CA (Copilot): ServerSelfCA.FinalizeOrder now requires a non-empty
OrderRef. The stateless self-CA never looks anything up by it, but the
guard keeps the contract uniform with provider adapters (the ACME issuer
needs the ref to resume the order), so a dropped ref fails the same way
in dev as it would against Let's Encrypt instead of silently issuing.
CLAUDE.md: add a non-negotiable rule requiring sufficient structured
logging (injected zerolog, component-tagged) in every package — INFO at
state transitions, DEBUG on expected detours, ERROR with context on
failures, never logging secrets/keys/tokens.
Signed-off-by: Connor Snitker <csnitker@godaddy.com>
The go.mod `go` line pinned a specific patch (`go 1.26.2`). With
GOTOOLCHAIN=auto that forces every contributor whose installed Go is an
earlier 1.26.x to download a 1.26.2 toolchain on the fly, and the two
toolchains then collide in the shared build cache during coverage
instrumentation ("compile: version go1.26.2 does not match go tool
version go1.26.1").
Nothing in the tree needs a 1.26.2-specific feature — patch releases add
no language or stdlib APIs, and the dependency floor is only 1.25.0 — so
declare the conventional minor floor instead. Any 1.26.x toolchain now
satisfies it with no download, and CI (go-version-file: go.mod) resolves
to the latest 1.26.x, picking up security patches automatically.
Signed-off-by: Connor Snitker <csnitker@godaddy.com>
renewal.sh's verify-acme step expects a synchronous COMPLETED, which covers BYOC and the CSR path against the local self-signed server CA. A CSR renewal against an asynchronous ACME provider (start.sh --with-acme) instead returns ISSUING_CERTIFICATE and must be re-driven by re-POSTing verify-acme — the renewal-lane analogue of the registration flow's acme-verify.sh, which had no counterpart. Add scripts/demo/renewal-acme-verify.sh: it reads the pending renewal, shows the provider's challenge artifacts to publish (or notes an authorization reuse with none), then loops verify-acme until the order leaves ISSUING_CERTIFICATE, failing on an RFC 7807 error or FAILED and printing the renewed leaf's TLSA record + certificate on COMPLETED. It also drives the synchronous self-CA CSR path (the loop simply breaks on the first COMPLETED), so it is exercisable without a live ACME provider. Cross-reference it from renewal.sh's header so the async path is discoverable instead of surfacing as a confusing "want COMPLETED, got ISSUING_CERTIFICATE" failure. Signed-off-by: Connor Snitker <csnitker@godaddy.com>
register.sh --register-only stops before activation, and acme-verify.sh only drives validation to PENDING_DNS; there was no script for the final verify-dns step, so finishing a register-only flow meant a hand-rolled curl. Add scripts/demo/verify-dns.sh: resolves the agent, POSTs verify-dns, and reports ACTIVE. Under the default noop DNS verifier it simply flips the agent to ACTIVE; under dns.type: lookup (e.g. start.sh --with-acme) it surfaces the missing/incorrect records so the operator can publish them and re-run. Idempotent; supports --v1/--v2/--agent. Signed-off-by: Connor Snitker <csnitker@godaddy.com>
Brings in #41 (verified identities), #44 (x/mod bump), and #45 (pluggable server-cert issuance via the certificate-order lifecycle). The two lanes reworked the same DNS-discovery and registration code in different directions; notable conflict resolutions: - DNS records keep PR #25's discovery-profile architecture. service.ComputeRequiredDNSRecords (registry-backed) supersedes main's re-added domain.ComputeRequiredDNSRecords; Revoke's DNSRecordsToRemove now calls the service method. - domain.TLSARecordForCert is kept for the renewal-status path (#45) but its DANE selector is corrected 3 1 1 -> 3 0 1 so the full-cert fingerprint validates — avoids re-introducing the bug PR #25 fixed. - Removed the now-unused service tlPublicBaseURL field + WithTLPublicBaseURL / TLPublicBaseURL accessors (and their test); the badge URL flows through the discovery registry (NewDefaultProfileRegistry) instead. - Registration drops the obsolete self-issued ACMEChallenge block (the domain field was replaced by #45's CertOrder) and keeps applyDiscoveryProfiles. - sqlite agent row persists both cert_order_* (#45) and discovery_profiles (PR #25); discovery-profiles migration renumbered 006 -> 010 (main now owns 006-009). Verified: build, vet, gofmt, full test suite (0 failures), docsui/spec parity, lint; coverage 90.2% (>= 90% gate). Signed-off-by: kperry <kperry@godaddy.com>
Brings in verified identities (#41), the x/mod 0.37.0 bump (#44), and pluggable server-cert issuance via the certificate-order lifecycle (#45). Both lanes now sit side by side: the finder feed/discovery surface and the verified-identity surface. Conflict resolutions: - internal/config RAConfig: keep both Identity (main) and EventsFeed (finder) fields. - internal/port/store.go: keep both FeedReader (finder) and IdentityStore/IdentityLinkStore (main) — independent ports. - cmd/ans-ra/main.go: construct the feed store + events service and the identity stores + identity service together; lifecycle handler is NewLifecycleHandler(regSvc, logger).WithIdentityViews(identitySvc). - spec/api-spec-v2.yaml + docsui mirror: keep both the Events and Verified Identities tags (docsui regenerated via make docs-sync). - scripts/demo/run-lifecycle.sh: keep finder's offline-verify (bin/ans-verify) and ans-finder discovery steps alongside main's identity steps; renumbered to 14-20. - internal/ra/handler/identity_handler_test.go: pass zerolog.Nop() to the logger-param handler constructors finder introduced. - internal/config: hoist the "self" and "noop" adapter-type discriminators to constants. goconst flags them only once both branches' validators (main's CA-server + resolver checks, finder's config package additions) combine in one package. make check passes; internal/ coverage 90.6% (>= 90% gate). Signed-off-by: kperry <kperry@godaddy.com>
Brings in verified identities (#41), the x/mod 0.37.0 bump (#44), and pluggable server-cert issuance via the certificate-order lifecycle (#45). Both lanes now sit side by side: the finder feed/discovery surface and the verified-identity surface. Conflict resolutions: - internal/config RAConfig: keep both Identity (main) and EventsFeed (finder) fields. - internal/port/store.go: keep both FeedReader (finder) and IdentityStore/IdentityLinkStore (main) — independent ports. - cmd/ans-ra/main.go: construct the feed store + events service and the identity stores + identity service together; lifecycle handler is NewLifecycleHandler(regSvc, logger).WithIdentityViews(identitySvc). - spec/api-spec-v2.yaml + docsui mirror: keep both the Events and Verified Identities tags (docsui regenerated via make docs-sync). - scripts/demo/run-lifecycle.sh: keep finder's offline-verify (bin/ans-verify) and ans-finder discovery steps alongside main's identity steps; renumbered to 14-20. - internal/ra/handler/identity_handler_test.go: pass zerolog.Nop() to the logger-param handler constructors finder introduced. - internal/config: hoist the "self" and "noop" adapter-type discriminators to constants. goconst flags them only once both branches' validators (main's CA-server + resolver checks, finder's config package additions) combine in one package. make check passes; internal/ coverage 90.6% (>= 90% gate). Signed-off-by: kperry <kperry@godaddy.com>
Brings in verified identities (#41), the x/mod 0.37.0 bump (#44), and pluggable server-cert issuance via the certificate-order lifecycle (#45). Both lanes now sit side by side: the finder feed/discovery surface and the verified-identity surface. Conflict resolutions: - internal/config RAConfig: keep both Identity (main) and EventsFeed (finder) fields. - internal/port/store.go: keep both FeedReader (finder) and IdentityStore/IdentityLinkStore (main) — independent ports. - cmd/ans-ra/main.go: construct the feed store + events service and the identity stores + identity service together; lifecycle handler is NewLifecycleHandler(regSvc, logger).WithIdentityViews(identitySvc). - spec/api-spec-v2.yaml + docsui mirror: keep both the Events and Verified Identities tags (docsui regenerated via make docs-sync). - scripts/demo/run-lifecycle.sh: keep finder's offline-verify (bin/ans-verify) and ans-finder discovery steps alongside main's identity steps; renumbered to 14-20. - internal/ra/handler/identity_handler_test.go: pass zerolog.Nop() to the logger-param handler constructors finder introduced. - internal/config: hoist the "self" and "noop" adapter-type discriminators to constants. goconst flags them only once both branches' validators (main's CA-server + resolver checks, finder's config package additions) combine in one package. make check passes; internal/ coverage 90.6% (>= 90% gate). Signed-off-by: kperry <kperry@godaddy.com>
Summary
Wires an RFC 8555 ACME provider (Let's Encrypt–shaped) alongside the local
self-signed CA behind a single
port.ServerCertificateIssuer, so a deploymentcan swap in a public or cloud CA (AWS Private CA, GCP CAS, etc.) without
touching the service layer. Issuance now runs through an explicit
certificate-order lifecycle rather than assuming synchronous, local signing.
Order lifecycle
CreateOrder(at registration / renewal submission) returns theprovider's domain-control challenges, relayed verbatim to the domain owner.
ANS never writes DNS or serves challenge files on the owner's behalf — the
pending response carries the records/paths for the owner to publish.
FinalizeOrder(atverify-acme, gated on a verified challenge) returnsthe certificate, or
ErrOrderPendingfor asynchronous providers such as ACMECAs. Re-POSTing
verify-acmere-drives the pending order (202/PENDING_CERTS), so the async path is plumbed end-to-end instead of beingskipped.
Identity certificates remain privately issued behind
port.IdentityCertificateAuthority(self-CA default; swappable for AWS PrivateCA / GCP CAS) and are signed only after the server order completes. The
identity CA port gains an idempotent
RevokeCertificate. Server-cert revocationis intentionally out of scope on the
ServerCertificateIssuerport for now(ACME RFC 8555 §7.6 for public CAs, a noop for BYOC); it can be added when a
server-cert revoke flow is needed.
Correctness / hardening
Closes holes so the flows behave correctly regardless of the underlying adapter:
FinalizeOrderon a verified DNS-01 or HTTP-01 artifact;gate/order rejections return
422, pending-conflict409.targets (loopback, link-local incl. the cloud metadata endpoint, RFC 1918,
ULA, RFC 6598 CGNAT
100.64.0.0/10, 6to4, NAT64), refuse redirects, boundedbody read — fails closed.
recoverable fault can never activate an agent and sign a wrong, immutable
transparency-log leaf.
(migrations
008/009); guarded set-based expiry of lapsed pendingvalidations; in-process agent auto-expiry sweeper.
Wire contract
spec/api-spec-v2.yamland the docsui copy stay byte-identical.PENDING_CERTSis restored to
RegistrationPending.status;CANCELadded to the next-stepaction enum.
Testing
make checkpasses (fmt,vet,golangci-lint, coverage gate).internal/domainat 100% statement coverage; overall ≥ 90%;make test-raceclean.
in-process RFC 8555 fake), the SSRF guard, and the SQLite persistence
round-trips.
scripts/demo/start.shbehind--with-acmefor live testing against a real domain + Let's Encrypt staging.
Review feedback addressed
http.DefaultTransport,inheriting
ProxyFromEnvironment— anHTTP_PROXY/HTTPS_PROXYcould routethe fetch through a (public, allowed) proxy that then reached an internal
target. Fixed by setting
Proxy = nilso the transport always dials theresolved FQDN directly and the dial guard stays authoritative.
Notes
Marked draft for review of the port surface before merge.
mainhas been mergedin; migrations are renumbered to
008/009to sequence after the verified-identities migrations (
006/007).